from PyQt5.QtWidgets import QWidget, QHBoxLayout, QSplitter, QFrame
from PyQt5.QtCore import Qt
from ui.selection import CSelectionView
from ui.toolbar import CToolBar
from ui.codeview import CCodeView

class CentralWidget(QWidget):
    """窗口主界面"""
    def __init__(self):
        super().__init__()
        self.main = None # 全部
        self.top = None # 顶部信息
        self.bottom = None # 底部操作
        self.bottom_left = None # 代码耗时信息
        self.bottom_right = None # 筛选
        self._init_widget()

    def _init_widget(self):
        """初始化界面"""
        hbox = QHBoxLayout(self)
        self.top = CToolBar()
        self.bottom = QSplitter(Qt.Horizontal)
        self.bottom.setFrameShape(QFrame.StyledPanel)
        self.bottom_left = CCodeView(self.bottom)
        self.bottom_left.resize(900,700)

        self.bottom_right = CSelectionView()
        self.bottom_right.setMinimumWidth(300)
        self.bottom_right.setMaximumWidth(400)
        self.bottom.addWidget(self.bottom_left)
        self.bottom.addWidget(self.bottom_right)
        self.main  = QSplitter(Qt.Vertical)
        self.main.addWidget(self.top)
        self.main.addWidget(self.bottom)

        hbox.addWidget(self.main)
        self.setLayout(hbox)